package com.cloud;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * jwt解析工具类
 */
@Component
public class JwtParse {
//    private Logger logger = LoggerFactory.getLogger(getClass());

    //解析token,获取userId, 判断token是否超时
    public Claims getClaimByToken(String token) {

        String secret = "f4e2e52034348f86b67cde581c0f9eb5[www.hugetower]";
        return Jwts.parser()
                .setSigningKey(secret)
                .parseClaimsJws(token)
                .getBody();
    }


}
